package net.mihome.app.bean;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import net.mihome.app.AppException;
import net.mihome.app.bean.net.ResponsePojo;
import net.mihome.app.common.StringUtils;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import android.util.Xml;

/**
 * 博客列表实体类
 * @author liux (http://my.oschina.net/liux)
 * @version 1.0
 * @created 2012-3-21
 */
public class BlogList extends Entity{
	
	public static final int CATALOG_USER = 1;//用户博客
	public static final int CATALOG_LATEST = 2;//最新博客
	public static final int CATALOG_RECOMMEND = 3;//推荐博客
	
	public static final String TYPE_LATEST = "latest";
	public static final String TYPE_RECOMMEND = "recommend";
	
	private int blogsCount;
	private int pageSize;
	private List<RssType> bloglist = new ArrayList<RssType>();
	
	public int getBlogsCount() {
		return blogsCount;
	}
	public int getPageSize() {
		return pageSize;
	}
	public List<RssType> getBloglist() {
		return bloglist;
	}
	public static BlogList parse(ResponsePojo responsePojo ) throws IOException, AppException {
		BlogList blogList = new BlogList();
		List list=(List) responsePojo.getData();
		if(list!=null&&!list.isEmpty()){
			Iterator iterator=list.iterator();
			while(iterator.hasNext()){
				Map map=(Map) iterator.next();
				RssType blog=RssType.parse(map);
				blogList.getBloglist().add(blog);
			}
		}
        return blogList;       
	}
}
